package com.ktg.mes.wm.domain;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.qc.domain.QcIqc;
import com.ktg.mes.util.LeftJoin;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;

/**
 * 物料入库单行对象 wm_item_recpt_line
 *
 * @author yinjinlu
 * @date 2022-05-22
 */
@Data
@Accessors(chain = true)
@TableName("wm_item_recpt_line")
public class WmItemRecptLine extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    public final static String mainSelectColumnNotId = "meterial_code,quantity_recived,quantity_out,batch_code,warehouse_name,expire_date";


    /** 行ID */
    @TableId(value = "line_id", type = IdType.AUTO)
    private Long lineId;

    /** 入库单ID */
    @Excel(name = "入库单ID")
    @LeftJoin(leftTable = "wm_item_recpt",leftTableColumn = "recpt_id",selectColumn = "vendor_code,vendor_name,vendor_nick,vendor_id")
    private Long recptId;


    private String recptCode;
    /** 产品物料ID */
    @Excel(name = "产品物料ID")
    @LeftJoin(leftTable ="md_item",leftTableColumn = "item_id",selectColumn = MdItem.mainSelectColumnNotId)
    private Long itemId;



    /** 统计分类 */
    @Excel(name = "统计分类")
    @TableField(exist = false)
    private String statisticsType;

    @TableField(exist = false)
    private String iType;


    @Excel(name = "粘度")
//    @TableField(exist = false)
    private String viscosity;

    /** 产品物料编码 */
    @Excel(name = "产品物料编码")
    private String itemCode;



    /** 产品物料名称 */
    @Excel(name = "产品物料名称")
    private String itemName;

    /** 单位 */
    @Excel(name = "单位")
    private String unitOfMeasure;

    /**
     * 产品规格
     */
    @Excel(name = "产品规格")
    private String specification;


    /**包装规格*/
    @Excel(name = "包装规格", width = 15)
    @ApiModelProperty(value = "包装规格")
    private String packingType;


    /** 标签 */
    @Excel(name = "标签")
    private String tag;

    /** 入库数量 */
    @Excel(name = "入库数量")
    private BigDecimal quantityRecived;

    /** 出库数量 */
    @Excel(name = "出库数量")
    private BigDecimal quantityOut;


    /** 库存数量 */
    @Excel(name = "库存数量")
    private BigDecimal quantity;


    /** 入库批次号 */
    @Excel(name = "入库批次号")
    private String batchCode;

    /** 仓库ID */
    @Excel(name = "仓库ID")
    private Long warehouseId;

    /**
     *  物料编码
     */
    @Excel(name = " 物料编码")
    private  String meterialCode;

    /** 仓库编码 */
    @Excel(name = "仓库编码")
    private String warehouseCode;

    /** 仓库名称 */
    @Excel(name = "仓库名称")
    private String warehouseName;

    /** 库区ID */
    @Excel(name = "库区ID")
    private Long locationId;

    /** 库区编码 */
    @Excel(name = "库区编码")
    private String locationCode;

    /** 库区名称 */
    @Excel(name = "库区名称")
    private String locationName;

    /** 库位ID */
    @Excel(name = "库位ID")
    private Long areaId;

    /** 库位编码 */
    @Excel(name = "库位编码")
    private String areaCode;

    /** 库位名称 */
    @Excel(name = "库位名称")
    private String areaName;

    /** 有效期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date expireDate;

    /**
     * 入库类型
     */
    @Excel(name = " 入库类型")
    private  String inType;
    @Excel(name = " 物料")
    private  String letStepMaterial;

    /**
     *  0 未检出 1 合格  2不合格  3让步接收
     */
    @Excel(name = " 物料状态")
    private  String status;


    /**
     *  0 未入库  1 已入库  null 已入库 , 3组装入库预入库部分 , 4组装全部预出
     */
    @Excel(name = " 是否执行入库")
    private  String isInStock;


    /** 任务ID */
    @Excel(name = "任务ID")
    private Long taskId;


    /** 客户产品需求ID */
    @Excel(name = "客户产品需求ID")
    private Long itemNeedId;


    /** 工单ID */
    @Excel(name = "工单ID")
    private Long workorderId;


    /** 来源入库记录ID */
    @Excel(name = "来源入库记录ID")
    private Long fromItemRecptId;

    /** 目前用来记录生产退料id,标识生产退料关联 */
    private String attr1;

    /** 目前用来记录生产日期 */
    private String attr2;

    /** 预留字段3 */
    private Long attr3;

    /** 预留字段4 */
    private Long attr4;

    @TableField(exist = false)
    private QcIqc gyiqcs;

    @TableField(exist = false)
    private QcIqc pziqcs;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date materialsInDate;

    @TableField(exist = false)
    private Long vendorId;

    /** 供应商编码 */
    @TableField(exist = false)
    private String vendorCode;

    /** 供应商名称 */
    @TableField(exist = false)
    private String vendorName;



    /**
     * 拆分记录id
     */
    private Long splitIdToIssueLineId;

    public void setLineId(Long lineId)
    {
        this.lineId = lineId;
    }

    public Long getLineId()
    {
        return lineId;
    }
    public void setRecptId(Long recptId)
    {
        this.recptId = recptId;
    }

    public Long getRecptId()
    {
        return recptId;
    }
    public void setItemId(Long itemId)
    {
        this.itemId = itemId;
    }

    public Long getItemId()
    {
        return itemId;
    }
    public void setQuantityRecived(BigDecimal quantityRecived)
    {
        this.quantityRecived = quantityRecived;
    }

    public BigDecimal getQuantityRecived()
    {
        return quantityRecived;
    }
    public void setBatchCode(String batchCode)
    {
        this.batchCode = batchCode;
    }

    public String getBatchCode()
    {
        return batchCode;
    }
    public void setWarehouseId(Long warehouseId)
    {
        this.warehouseId = warehouseId;
    }

    public Long getWarehouseId()
    {
        return warehouseId;
    }
    public void setWarehouseCode(String warehouseCode)
    {
        this.warehouseCode = warehouseCode;
    }

    public String getWarehouseCode()
    {
        return warehouseCode;
    }
    public void setWarehouseName(String warehouseName)
    {
        this.warehouseName = warehouseName;
    }

    public String getWarehouseName()
    {
        return warehouseName;
    }
    public void setLocationId(Long locationId)
    {
        this.locationId = locationId;
    }

    public Long getLocationId()
    {
        return locationId;
    }
    public void setLocationCode(String locationCode)
    {
        this.locationCode = locationCode;
    }

    public String getLocationCode()
    {
        return locationCode;
    }
    public void setLocationName(String locationName)
    {
        this.locationName = locationName;
    }

    public String getLocationName()
    {
        return locationName;
    }
    public void setAreaId(Long areaId)
    {
        this.areaId = areaId;
    }

    public Long getAreaId()
    {
        return areaId;
    }
    public void setAreaCode(String areaCode)
    {
        this.areaCode = areaCode;
    }

    public String getAreaCode()
    {
        return areaCode;
    }
    public void setAreaName(String areaName)
    {
        this.areaName = areaName;
    }

    public String getAreaName()
    {
        return areaName;
    }
    public void setExpireDate(Date expireDate)
    {
        this.expireDate = expireDate;
    }

    public Date getExpireDate()
    {
        return expireDate;
    }
    public void setAttr1(String attr1)
    {
        this.attr1 = attr1;
    }

    public String getAttr1()
    {
        return attr1;
    }
    public void setAttr2(String attr2)
    {
        this.attr2 = attr2;
    }

    public void setProductDate(String productDate){
        this.attr2 = productDate;
    }

    public String getProductDate(){
        return this.attr2;
    }

    public String getAttr2()
    {
        return attr2;
    }
    public void setAttr3(Long attr3)
    {
        this.attr3 = attr3;
    }

    public Long getAttr3()
    {
        return attr3;
    }
    public void setAttr4(Long attr4)
    {
        this.attr4 = attr4;
    }

    public Long getAttr4()
    {
        return attr4;
    }

    public String getMaterialStockKey(){
        return  getItemCode()+":"+getWarehouseCode()+":"+getBatchCode();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("lineId", getLineId())
            .append("recptId", getRecptId())
            .append("itemId", getItemId())
            .append("quantityRecived", getQuantityRecived())
            .append("batchCode", getBatchCode())
            .append("warehouseId", getWarehouseId())
            .append("warehouseCode", getWarehouseCode())
            .append("warehouseName", getWarehouseName())
            .append("locationId", getLocationId())
            .append("locationCode", getLocationCode())
            .append("locationName", getLocationName())
            .append("areaId", getAreaId())
            .append("areaCode", getAreaCode())
            .append("areaName", getAreaName())
            .append("expireDate", getExpireDate())
            .append("remark", getRemark())
            .append("attr1", getAttr1())
            .append("attr2", getAttr2())
            .append("attr3", getAttr3())
            .append("attr4", getAttr4())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("meterial_code",getMeterialCode())
            .append("status", getStatus())
            .append("isInStock", getIsInStock())

            .toString();
    }
}
